<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Student extends Model
{
    protected $fillable = [
        'class', 'major',
    ];
    public function user()
    {
        return $this->belongsTo('App\User');
    }

    /**
     * Get all supervisors.
    */
    public function supervisors()
    {
        return $this->belongsToMany('App\Supervisor')->withPivot('isApproved');;
    }

    /** thesis
    */
    public function thesis()
    {
        return $this->hasOne('App\Thesis');
    }

    public function title()
    {
        return $this->hasMany('App\Title');
    }

    public function description()
    {
        return $this->hasMany('App\Description');
    }

    public function proposal()
    {
        return $this->hasMany('App\Proposal');
    }

    public function paper()
    {
        return $this->hasMany('App\Paper');
    }

    public function supervise_comment()
    {
        return $this->hasOne('App\SupervisorComment');
    }

    public function review_comment()
    {
        return $this->hasOne('App\ReviewerComment');
    }   

    public function defense_comment()
    {
        return $this->hasOne('App\DefenseComment');
    }   


    public function reviewer()
    {
        return $this->belongsToMany('App\Supervisor', "reviewers");
    }

    public function defense_teacher()
    {
        return $this->belongsToMany('App\Supervisor', "defenseteachers");
    }
}

